<?php

abstract class ui_input extends ui
{
	function __construct()
	{
		global $ti;
		$this->init(__FILE__,'input');
	}
	
	function init($file,$tag,$params=array(),$quickclose=null)
	{
		global $ti;
		parent::init($file,$tag,$params,$quickclose);
		if($ti->config['var.lastform'])
		{
			$ti->config['var.lastform']->elements[] = $this;
			$this->form = $ti->config['var.lastform'];
		}
	}
	
	function set_name($new_name)
	{
		$this->attributes['name'] = $new_name;
		$this->name = $new_name;
	}
	
	function pre_render($data=null)
	{
		if(is_array($data))
		{
			#echo('found an array: '.$this->class.'/'.$data[$this->name]."\n<br />");
			if(!empty($data[$this->name]))
			{
				#echo('found the fields value: '.$data[$this->name]);
				$this->set('value',$data[$this->name]);
			}
			else
			{
				#echo('didnt find a value');
			}
		}
		else
		{
			#echo('not an array: '.$this->class."/".$this->get('name')."\n<br />");
		}
	}
}

?>